import { createStore } from 'redux'
import rootReducer from '../reducers/rootReducer'

export default function configureStore(initialState) {
    const store = createStore(rootReducer, initialState,
        window.devToolsExtension ? window.devToolsExtension() : undefined
    )

    // 这个是配合热更新的代码
    //if (module.hot) {
    //    // Enable Webpack hot module replacement for reducers
    //    module.hot.accept('../reducers', () => {
    //        const nextReducer = require('../reducers').default
    //        store.replaceReducer(nextReducer)
    //    })
    //}

    return store
}